package com.mica.erp.contract.service.impl;

import java.util.List;

import com.mica.erp.contract.model.Customer;
import com.mica.erp.contract.service.CustomerService;
import com.mica.mybatis.GenericService;

public class CustomerServiceImpl extends GenericService implements
		CustomerService {

	@Override
	public List<Customer> findCustomers(Customer customer) {
		return this.selectList(namespace+".findCustomers", customer);
	}

	@Override
	public Customer findCustomer(Customer customer) {
		return this.selectOne(namespace+".findCustomers", customer);
	}

	@Override
	public void saveCustomer(Customer customer) {
		Long ctId = customer.getCtId();
		if(null!=ctId){
			this.update(namespace+".updateCustomer", customer);
		}else{
			customer.setCtId(this.incre.nextLongValue());
			this.insert(namespace+".insertCustomer", customer);
		}
	}

	@Override
	public void delCustomer(Long ctId) {
		this.delete(namespace+".delCustomer", ctId);
	}

}
